package com.jianying.mapper;

import org.springframework.stereotype.Repository;

import com.jianying.base.BaseMapper;
import com.jianying.dataSource.TargetDataSource;
import com.jianying.domain.User;

@Repository("userMapper")
public class UserMapper extends BaseMapper {
	
	private static final String NAME_SPACE = "com.jianying.mapper.UserMapper.";
	
	@TargetDataSource(name="ds1")
	public void insert(User user){
		getSqlSessionTemplate().insert(NAME_SPACE + "insert", user);
	}
	
	public User find(Integer id){
		return getSqlSessionTemplate().selectOne(NAME_SPACE + "find", id);
	}
	
	@TargetDataSource(name="ds1")
	public User findByUnionid(String openid) {
		return getSqlSessionTemplate().selectOne(NAME_SPACE + "findByUnionid", openid);
	}

}
